﻿<controls:ChildWindow
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="LantinxLBS.Views.FrmRole2"
           Width="600" Height="500" 
           Title="用户管理">
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.Resources>
            <DataTemplate x:Key="styleRole">
                <TextBlock Text="{Binding RoleName}"/>
            </DataTemplate>

            <DataTemplate x:Key="styleUser">
                <StackPanel Orientation="Horizontal">
                    <Button Click="Button_Click" Content="删除"/>
                    <TextBlock Text="用户名:"/>
                    <TextBlock Text="{Binding UserName}"/>
                    <TextBlock Text="电话号码:"/>
                    <TextBlock Text="{Binding Phone}"/>
                </StackPanel>
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Height="424" HorizontalAlignment="Left" x:Name="grid1" VerticalAlignment="Top" Width="566">
            <Grid.RowDefinitions>
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="63" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="26" />
                <RowDefinition Height="108*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80*" />
                <ColumnDefinition Width="398*" />
            </Grid.ColumnDefinitions>
            <TextBlock Height="23" HorizontalAlignment="Left" x:Name="textBlock1" Text="角色名:" VerticalAlignment="Top" Width="80" Grid.ColumnSpan="2" Margin="6,3,0,0" />
            <TextBox Grid.Column="1" Height="26" MaxLength="25"
                     HorizontalAlignment="Left" x:Name="txtRoleName" VerticalAlignment="Top" 
                     Width="471" 
                     Text="{Binding SelectedItem.RoleName, ElementName=cmbList, Mode=TwoWay}" 
                     />
            <ListBox Grid.Column="1" Height="63"  ItemTemplate="{StaticResource styleRole}" 
                      HorizontalAlignment="Left" x:Name="cmbList" VerticalAlignment="Top" Width="471" Grid.Row="2" />
            <StackPanel Grid.Column="1" Height="26" HorizontalAlignment="Left" x:Name="stackPanel1" VerticalAlignment="Top" Width="230" Orientation="Horizontal" Grid.Row="1" Margin="242,2,0,0" Grid.RowSpan="2">
                <Button Content="添加角色" Height="23" x:Name="btnAdd" Width="75" Click="btnAdd_Click" />
                <Button Content="修改角色" Height="23" x:Name="btnEdit" Width="75" Click="btnEdit_Click" />
                <Button Content="删除角色" Height="23" x:Name="btnDelete" Width="75" Click="btnDelete_Click" />
            </StackPanel>
            <TextBlock Grid.Row="2" Height="23" HorizontalAlignment="Left" x:Name="textBlock2" Text="角色列表:" VerticalAlignment="Top" Margin="6,0,0,0" />
            <TextBlock Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock3" Text="用户管理:" VerticalAlignment="Top" Width="77" />
            <TextBlock Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="6,3,0,0" x:Name="textBlock4" Text="选择角色:" VerticalAlignment="Top" />
            <ComboBox Grid.Column="1" Grid.Row="4" Height="27" HorizontalAlignment="Left" ItemTemplate="{StaticResource styleRole}" 
                      Margin="0,-1,0,0" x:Name="cmbChooseRole" VerticalAlignment="Top" Width="471" />
            <TextBlock Grid.Row="5" Grid.RowSpan="2" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock5" Text="帐号:" VerticalAlignment="Top" />
            <TextBlock Grid.Row="6" Height="23" HorizontalAlignment="Left" Margin="6,1,0,0" x:Name="textBlock6" Text="用户名:" VerticalAlignment="Top" />
            <TextBlock Grid.Row="7" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock7" Text="输入密码:" VerticalAlignment="Top" />
            <TextBlock Grid.Row="8" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock8" Text="再次输入密码:" VerticalAlignment="Top" />
            <TextBlock Grid.Row="9" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock9" Text="电话号码:" VerticalAlignment="Top" />
            <TextBox Grid.Column="1" Grid.Row="5" Grid.RowSpan="2" Height="26" HorizontalAlignment="Left" MaxLength="25"
                     x:Name="txtUserAlias" VerticalAlignment="Top" Width="471" />
            <TextBox Grid.Column="1" Grid.Row="6" Height="25" HorizontalAlignment="Left" 
                     MaxLength="25"
                     Margin="0,1,0,0" x:Name="txtUserName" VerticalAlignment="Top" Width="471" />
            <PasswordBox Grid.Column="1" Grid.Row="8" Height="26" 
                         MaxLength="16"
                         HorizontalAlignment="Left" x:Name="txtPassword2" VerticalAlignment="Top" Width="270" />
            <TextBox Grid.Column="1" Grid.Row="9" Height="26" HorizontalAlignment="Left"
                     MaxLength="25"
                     x:Name="txtPhone" VerticalAlignment="Top" Width="270" />
            <ListBox Grid.Column="1" Grid.Row="10" Height="127" HorizontalAlignment="Left"
                     ItemTemplate="{StaticResource styleUser}" SelectionChanged="lstUsers_SelectionChanged"
                     x:Name="lstUsers" VerticalAlignment="Top" Width="471" />
            <TextBlock Grid.Row="10" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" x:Name="textBlock10" Text="用户列表:" VerticalAlignment="Top" />
        	<PasswordBox x:Name="txtPassword" Grid.Column="1"
                         MaxLength="16"
                         Margin="0,0,201,0" Grid.Row="7"/>
        </Grid>
        <StackPanel Grid.Row="1" Height="26" x:Name="stackPanel2" VerticalAlignment="Top" Orientation="Horizontal" Margin="0,8,0,0" HorizontalAlignment="Right" Width="235">
            <Button Content="添加用户" Height="23" x:Name="btnAddUser" Width="75" Click="btnAddUser_Click" />
            <Button Content="修改用户" Height="23" x:Name="btnEditUser" Width="75" Click="btnEditUser_Click" />
            <Button x:Name="btnCancel" Content="退出" Click="CancelButton_Click" Width="75" Height="23" />
        </StackPanel>
    </Grid>
</controls:ChildWindow>